//
//  MoneyView.m
//  项目三
//
//  Created by rimi on 15/10/8.
//  Copyright (c) 2015年 rimi. All rights reserved.
//

#import "MoneyView.h"

@interface MoneyView ()

@property (nonatomic, strong) UIImageView *searchImageView;
@property (nonatomic, strong) UIImageView *choseImageView;
@property (nonatomic, strong) UIImageView *imageView;

- (void)initializeUserInterface; /**< 初始化用户界面 */

@end

@implementation MoneyView

- (id)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        // Initialization code
        [self initializeUserInterface];
    }
    return self;
}

- (instancetype)init {
    self = [super init];
    if (self) {
        [self initializeUserInterface];
    }
    return self;
}

- (void)initializeUserInterface {
    
    self.backgroundColor = COLOR(205, 205, 205, 1);
    
    UIButton *leftBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    [leftBtn setBackgroundColor:[UIColor clearColor]];
    [leftBtn addTarget:self action:@selector(respondsToLButton:) forControlEvents:UIControlEventTouchUpInside];
    [leftBtn setFrame:DHFlexibleFrame(CGRectMake(40, 40, 100, 35))];
    [self addSubview:leftBtn];
    
    UIButton *rightBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    [rightBtn setBackgroundColor:[UIColor clearColor]];
    [rightBtn addTarget:self action:@selector(respondsToRButton:) forControlEvents:UIControlEventTouchUpInside];
    [rightBtn setFrame:DHFlexibleFrame(CGRectMake(152, 40, 100, 35))];
    [self addSubview:rightBtn];
    
    [self addSubview:self.searchImageView];
    [self addSubview:self.choseImageView];
    [self addSubview:self.imageView];
}
#pragma mark - Button Events
- (void)respondsToLButton:(UIButton *)sender {

    self.choseImageView.image = [UIImage imageNamed:@"理财选中_基金未选中"];
    self.imageView.image = [UIImage imageNamed:@"金融资讯-投资理财-理财表格"];
}
- (void)respondsToRButton:(UIButton *)sender {

    self.choseImageView.image = [UIImage imageNamed:@"理财未选中_基金选中"];
    self.imageView.image = [UIImage imageNamed:@"金融资讯-投资理财-基金表"];
}
#pragma mark - getter
- (UIImageView *)choseImageView {

    if (!_choseImageView) {
        _choseImageView = [[UIImageView alloc] initWithFrame:DHFlexibleFrame(CGRectMake(32, 40, 627, 35))];
        _choseImageView.image = [UIImage imageNamed:@"理财选中_基金未选中"];
    }
    return _choseImageView;
}
- (UIImageView *)searchImageView {

    if (!_searchImageView) {
        _searchImageView = [[UIImageView alloc] initWithFrame:DHFlexibleFrame(CGRectMake(350, 100, 316, 30))];
        _searchImageView.image = [UIImage imageNamed:@"搜索框.png"];
    }
    return _searchImageView;
}
- (UIImageView *)imageView {

    if (!_imageView) {
        _imageView = [[UIImageView alloc] initWithFrame:DHFlexibleFrame(CGRectMake(34, 153, 627, 681))];
        _imageView.image = [UIImage imageNamed:@"金融资讯-投资理财-理财表格"];
    }
    return _imageView;
}
@end
